<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
      <title>GTL - Graph Template Library: dijkstra.h Source File</title>
      <link href="doxygen.css" rel="stylesheet" type="text/css">
  </head>
  <body>
    <p class="links">  
      <a href="../index.html">Home</a> |
      Documentation |
      <a href="../register.html">Download</a> |
      <a href="../platforms.html">Platforms</a> |
      <a href="../refer.html">Projects</a> |      
      <a href="../lists.html">Mailing Lists</a> |
      <a href="../history.html">Version History</a>
    </p>

<!-- Generated by Doxygen 1.5.3 -->
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="classes.html"><span>Classes</span></a></li>
    <li class="current"><a href="files.html"><span>Files</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
  </ul>
</div>
<h1>dijkstra.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">//==========================================================================</span>
<a name="l00002"></a>00002 <span class="comment">//</span>
<a name="l00003"></a>00003 <span class="comment">//   dijkstra.h</span>
<a name="l00004"></a>00004 <span class="comment">//</span>
<a name="l00005"></a>00005 <span class="comment">//==========================================================================</span>
<a name="l00006"></a>00006 <span class="comment">// $Id: dijkstra.h,v 1.8 2003/02/25 09:18:19 chris Exp $</span>
<a name="l00007"></a>00007 
<a name="l00008"></a>00008 <span class="preprocessor">#ifndef GTL_DIJKSTRA_H</span>
<a name="l00009"></a>00009 <span class="preprocessor"></span><span class="preprocessor">#define GTL_DIJKSTRA_H</span>
<a name="l00010"></a>00010 <span class="preprocessor"></span>
<a name="l00011"></a>00011 <span class="preprocessor">#include &lt;GTL/GTL.h&gt;</span>
<a name="l00012"></a>00012 <span class="preprocessor">#include &lt;GTL/graph.h&gt;</span>
<a name="l00013"></a>00013 <span class="preprocessor">#include &lt;GTL/node_map.h&gt;</span>
<a name="l00014"></a>00014 <span class="preprocessor">#include &lt;GTL/edge_map.h&gt;</span>
<a name="l00015"></a>00015 <span class="preprocessor">#include &lt;GTL/algorithm.h&gt;</span>
<a name="l00016"></a>00016 
<a name="l00017"></a>00017 __GTL_BEGIN_NAMESPACE
<a name="l00018"></a>00018 
<a name="l00029"></a><a class="code" href="a00009.html">00029</a> <span class="keyword">class </span>GTL_EXTERN <a class="code" href="a00009.html" title="Dijkstra&amp;#39;s Algorithm for computing single source shortest path.">dijkstra</a> : <span class="keyword">public</span> <a class="code" href="a00001.html" title="Abstract baseclass for all algoritm-classes.">algorithm</a>
<a name="l00030"></a>00030 {
<a name="l00031"></a>00031 <span class="keyword">public</span>:
<a name="l00035"></a><a class="code" href="a00009.html#5062e9a8339848666efcf2143c4c1881">00035</a>     <span class="keyword">typedef</span> list&lt;node&gt;::const_iterator shortest_path_node_iterator;
<a name="l00036"></a>00036 
<a name="l00040"></a><a class="code" href="a00009.html#d35d95d4ed7a4202a5d048a63aa115b9">00040</a>     <span class="keyword">typedef</span> list&lt;edge&gt;::const_iterator shortest_path_edge_iterator;
<a name="l00041"></a>00041 
<a name="l00045"></a>00045     <span class="keyword">enum</span> node_color {white, grey, black};
<a name="l00046"></a>00046 
<a name="l00054"></a>00054     <a class="code" href="a00009.html" title="Dijkstra&amp;#39;s Algorithm for computing single source shortest path.">dijkstra</a>();
<a name="l00055"></a>00055 
<a name="l00061"></a>00061     <span class="keyword">virtual</span> ~<a class="code" href="a00009.html" title="Dijkstra&amp;#39;s Algorithm for computing single source shortest path.">dijkstra</a>();
<a name="l00062"></a>00062 
<a name="l00072"></a>00072     <span class="keywordtype">void</span> source(<span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; n);
<a name="l00073"></a>00073 
<a name="l00083"></a>00083     <span class="keywordtype">void</span> target(<span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; n);
<a name="l00084"></a>00084 
<a name="l00092"></a>00092     <span class="keywordtype">void</span> weights(<span class="keyword">const</span> <a class="code" href="a00011.html" title="A specialized map with edges as keys.">edge_map&lt;double&gt;</a>&amp; weight);
<a name="l00093"></a>00093     
<a name="l00105"></a>00105     <span class="keywordtype">void</span> store_preds(<span class="keywordtype">bool</span> <span class="keyword">set</span>);
<a name="l00106"></a>00106 
<a name="l00125"></a>00125     <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="a00001.html#76361fb03ad1cf643affc51821e43bed" title="Checks whether all preconditions are satisfied.">check</a>(<a class="code" href="a00014.html" title="A directed or undirected graph.">graph</a>&amp; G);
<a name="l00126"></a>00126             
<a name="l00141"></a>00141     <span class="keywordtype">int</span> <a class="code" href="a00001.html#734b189509a8d6b56b65f8ff772d43ca" title="Applies algorithm to graph g.">run</a>(<a class="code" href="a00014.html" title="A directed or undirected graph.">graph</a>&amp; G);
<a name="l00142"></a>00142 
<a name="l00148"></a>00148     <a class="code" href="a00020.html" title="A node in a graph.">node</a> source() <span class="keyword">const</span>;
<a name="l00149"></a>00149 
<a name="l00155"></a>00155     <a class="code" href="a00020.html" title="A node in a graph.">node</a> target() <span class="keyword">const</span>;
<a name="l00156"></a>00156 
<a name="l00164"></a>00164     <span class="keywordtype">bool</span> store_preds() <span class="keyword">const</span>;
<a name="l00165"></a>00165 
<a name="l00173"></a>00173     <span class="keywordtype">bool</span> reached(<span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; n) <span class="keyword">const</span>;
<a name="l00174"></a>00174 
<a name="l00182"></a>00182     <span class="keywordtype">double</span> distance(<span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; n) <span class="keyword">const</span>;
<a name="l00183"></a>00183 
<a name="l00201"></a>00201     <a class="code" href="a00020.html" title="A node in a graph.">node</a> predecessor_node(<span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; n) <span class="keyword">const</span>;
<a name="l00202"></a>00202 
<a name="l00220"></a>00220     <a class="code" href="a00010.html" title="An edge in a graph.">edge</a> predecessor_edge(<span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; n) <span class="keyword">const</span>;
<a name="l00221"></a>00221 
<a name="l00236"></a>00236     shortest_path_node_iterator shortest_path_nodes_begin(<span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; dest);
<a name="l00237"></a>00237 
<a name="l00252"></a>00252     shortest_path_node_iterator shortest_path_nodes_end(<span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; dest);
<a name="l00253"></a>00253 
<a name="l00268"></a>00268     shortest_path_edge_iterator shortest_path_edges_begin(<span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; dest);
<a name="l00269"></a>00269 
<a name="l00284"></a>00284     shortest_path_edge_iterator shortest_path_edges_end(<span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; dest);
<a name="l00285"></a>00285 
<a name="l00296"></a>00296     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="a00001.html#21aba63d066ae7897de6ca7d8425c408" title="Resets algorithm.">reset</a>();
<a name="l00297"></a>00297 <span class="keyword">private</span>:
<a name="l00304"></a>00304     <a class="code" href="a00020.html" title="A node in a graph.">node</a> s;
<a name="l00305"></a>00305 
<a name="l00312"></a>00312     <a class="code" href="a00020.html" title="A node in a graph.">node</a> t;
<a name="l00313"></a>00313 
<a name="l00320"></a>00320     <span class="keywordtype">bool</span> weights_set;
<a name="l00321"></a>00321 
<a name="l00328"></a>00328     <span class="keywordtype">bool</span> preds_set;
<a name="l00329"></a>00329 
<a name="l00336"></a>00336     <a class="code" href="a00011.html" title="A specialized map with edges as keys.">edge_map&lt;double&gt;</a> weight;
<a name="l00337"></a>00337 
<a name="l00345"></a>00345     <a class="code" href="a00021.html" title="A specialized map with nodes as keys.">node_map&lt;edge&gt;</a> pred;
<a name="l00346"></a>00346 
<a name="l00352"></a>00352     <a class="code" href="a00021.html" title="A specialized map with nodes as keys.">node_map&lt;int&gt;</a> mark;
<a name="l00353"></a>00353 
<a name="l00361"></a>00361     <a class="code" href="a00021.html" title="A specialized map with nodes as keys.">node_map&lt;double&gt;</a> dist;
<a name="l00362"></a>00362 
<a name="l00373"></a>00373     <a class="code" href="a00021.html" title="A specialized map with nodes as keys.">node_map&lt;list&lt;node&gt;</a> &gt; shortest_path_node_list;
<a name="l00374"></a>00374 
<a name="l00385"></a>00385     <a class="code" href="a00021.html" title="A specialized map with nodes as keys.">node_map&lt;list&lt;edge&gt;</a> &gt; shortest_path_edge_list;
<a name="l00386"></a>00386 
<a name="l00391"></a>00391     <span class="keywordtype">void</span> reset_algorithm();
<a name="l00392"></a>00392     
<a name="l00397"></a>00397     <span class="keywordtype">void</span> init(<a class="code" href="a00014.html" title="A directed or undirected graph.">graph</a>&amp; G);
<a name="l00398"></a>00398 
<a name="l00404"></a>00404     <span class="keywordtype">void</span> fill_node_list(<span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; t);
<a name="l00405"></a>00405 
<a name="l00411"></a>00411     <span class="keywordtype">void</span> fill_edge_list(<span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; t);
<a name="l00412"></a>00412 };
<a name="l00413"></a>00413 
<a name="l00414"></a>00414 __GTL_END_NAMESPACE
<a name="l00415"></a>00415 
<a name="l00416"></a>00416 <span class="preprocessor">#endif // GTL_DIJKSTRA_H</span>
<a name="l00417"></a>00417 <span class="preprocessor"></span>
<a name="l00418"></a>00418 <span class="comment">//--------------------------------------------------------------------------</span>
<a name="l00419"></a>00419 <span class="comment">//   end of file</span>
<a name="l00420"></a>00420 <span class="comment">//--------------------------------------------------------------------------</span>
</pre></div>    <p class="links">
      <a href="http://www.uni-passau.de/">University of Passau</a>
      &nbsp;-&nbsp;
      <a href="http://www.fmi.uni-passau.de/">FMI</a>
      &nbsp;-&nbsp;
      <a href="http://www.fmi.uni-passau.de/fmi/lehrstuehle/brandenburg/">Theoretical
	Computer Science</a>
    </p>
  <div class="copyright">
      Design &copy; 2002, 2003 <a href="mailto:raitner@fmi.uni-passau.de">Marcus Raitner</a>,  University of Passau 
  </div>
</body>
</html>
